import { useEffect, useState } from "react";
import "./App.css";

function App() {
   const [count, setCount] = useState(0)

   useEffect(() => {
    // 这样会跑很多次定时器
    console.log(count, 'count');
    setInterval(() => {
        setCount(count + 1)
    }, 1000)
   }, [count])

   return <>
    <div>{count}</div>
   </>
}

export default App;
